from django.urls import re_path, include
from rest_framework.routers import DefaultRouter
from .apis import ChatRecordViewSet, WordReplyMapViewSet
from .views import get_high_rate_words, upload, index, room

router = DefaultRouter()
router.register(r'chat', ChatRecordViewSet, basename='chat')
router.register(r'wordreply', WordReplyMapViewSet, basename='wordreply')

urlpatterns = [
    re_path(r'^api/', include((router.urls, 'chat-api'),
                              namespace='chat-api')),  # 接口地址
    re_path(r'^high_rate_words/', get_high_rate_words,
            name='high_rate_words'),  # 高频词汇统计
    re_path(r'^upload/', upload, name='upload'),  # 图片上传
    re_path('(?P<room_name>.+)/(?P<chat_target>.+)/', room, name='room'),
    re_path(r'', index, name='index'),

]
